#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
    vector<vector<int>> merge(vector<vector<int>>& intervals) {
        vector<vector<int>> vec;
        sort(intervals.begin(),intervals.end(),[](vector<int> a,vector<int> b){return a[0]<b[0];});
        for(auto& it:intervals)
        {
            if(!vec.empty()&&it[0]<=vec.back()[1])
                vec.back()[1]=max(vec.back()[1],it[1]);
            else vec.emplace_back(it);
        }
        return vec;
    }
};

int main()
{
    vector<vector<int>> vec={{1,4},{1,4}};
    Solution so;
    so.merge(vec);
    return 0;
}